package edu.bbu.commonproject.desktop.client.services;

import edu.bbu.commonproject.desktop.client.exceptions.DecryptErrorException;
import edu.bbu.commonproject.desktop.client.exceptions.EmailSendingException;
import edu.bbu.commonproject.desktop.client.exceptions.NoConnectionException;
import edu.bbu.commonproject.desktop.client.exceptions.WrongUserDataException;
import edu.bbu.commonproject.desktop.client.model.UserPOJO;
import edu.bbu.commonproject.desktop.client.exceptions.DataBaseErrorException;

/**
 * Interfaces that all UserCLTServices must support.
 */
public interface UserCLTServices
{
	/**
	 * Logging on the user.
	 * @param user the user.
	 * @return true if the logon succesfull, false otherwise.
	 * @throws NoConnectionException if the connaction lost.
	 */
	public abstract void logonUser(UserPOJO user) throws NoConnectionException, WrongUserDataException, DataBaseErrorException;
	
	/**
	 * Registering a new user.
	 * @param user the user.
	 * @return true if the registering succesfull, false otherwise.
	 * @throws NoConnectionException if the connaction lost.
	 */
	public abstract void registerUser(UserPOJO user) throws NoConnectionException, DecryptErrorException, WrongUserDataException, DataBaseErrorException, EmailSendingException;
	
	/**
	 * Changing the user password.
	 * @param user the user.
	 * @param newPassword the nem password.
	 * @return true if the change succesfull, false otherwise.
	 * @throws NoConnectionException if the connaction lost.
	 */
	public abstract void changePassword(UserPOJO user, String newPassword) throws NoConnectionException, WrongUserDataException, DataBaseErrorException;
	
	/**
	 * Getting a new password if the current was forgotten.
	 * @param user the user.
	 * @param newPassword the nem password.
	 * @return true if the change succesfull, false otherwise.
	 * @throws NoConnectionException if the connaction lost.
	 */
	public abstract void forgotPassword(UserPOJO user, String newPassword) throws NoConnectionException, DecryptErrorException, WrongUserDataException, DataBaseErrorException, EmailSendingException;
	
	/**
	 * Deleting a user.
	 * @param user the user.
	 * @return true if the deleting succesfull, false otherwise.
	 * @throws NoConnectionException if the connaction lost.
	 */
	public abstract void deleteUser(UserPOJO user) throws NoConnectionException, WrongUserDataException, DataBaseErrorException;
}
